package tool;

import java.io.IOException;
import java.io.InputStream;

import javax.microedition.io.Connector;
import javax.microedition.io.file.FileConnection;
import javax.microedition.lcdui.Image;

import boot.Boot;

public class ImageUtils {

	public static final String IMAGE_FOLDER
		= "file:///E:/Data/Applications/Boot";
	
	public static Image getImageFromImageFolder(String shortPath) {
		return getImageFromSDCard(IMAGE_FOLDER + shortPath);
	}
	
	public static Image getImageFromSDCard(String imagePath) {
		Image image = null;
		try {
			FileConnection fconn = (FileConnection) Connector
					.open(imagePath);
			InputStream in = fconn.openInputStream();
			image = Image.createImage(in);
			in.close();
			fconn.close();
		} catch (IOException e) {
			Boot.alertException(e, new ImageUtils(), "geTimageFromSDCard()");
		}
		return image;
	}
}
